﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1.segments.data_type
{
    class CM_MOC
    {
        public StringBuilder Dollar_Amount { get; set; }
        public StringBuilder Charge_Code { get; set; }
    
        
        public int fill(string source, int temp)
        {
            int i, x = 0;
            for (i = temp; i < source.Length; i++)
            {
                if (source[i] == '^')
                    x++;
                else if (source[i] == '|')
                {
                    Dollar_Amount.Capacity = Dollar_Amount.Length;
                    Charge_Code.Capacity = Charge_Code.Length;
                    return i;
                }

                else if (x == 0)
                {
                    if (Dollar_Amount == null)
                        Dollar_Amount = new StringBuilder();
                    Dollar_Amount.Insert(Dollar_Amount.Length, source[i]);
                }
                else if (x == 1)
                {
                    if (Charge_Code == null)
                        Charge_Code = new StringBuilder();
                    Charge_Code.Insert(Charge_Code.Length, source[i]);                   
                }
            }
            return i;
        }
    }
}
